package top.aiprogram.user.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.aiprogram.user.dao.StudentMapper;
import top.aiprogram.user.entity.Student;
import top.aiprogram.user.entity.Teacher;

import javax.transaction.Transactional;

@Service("studentServiceImpl")
public class StudentServiceImpl implements StudentService{
    @Autowired
    private StudentMapper studentMapper;
    @Autowired
    private TeacherService teacherService;
    @Override
    @Transactional
    public int createStudent(Student student) {
        studentMapper.insertSelective(student);
        Teacher teacher = new Teacher();
        teacher.setTid(1);
        teacher.setTname("laowang");
        teacher.setTpwd("123");
        teacher.setTuser("laowang");
        teacherService.createTeacher(teacher);
        return 0;
    }
}
